echo "Shutting down Tomcat(1,2)..."
ssh root@sw-as1 /home/tomcat/apache-tomcat-7.0.23/bin/shutdown.sh
ssh root@sw-as2 /home/tomcat/apache-tomcat-7.0.23/bin/shutdown.sh

echo "Recreating DB..."
scp src/sql/MySQLCreateTables.sql root@sw-my:~/
scp src/sql/MySQLTestData.sql root@sw-my:~/
ssh root@sw-my ./createdb.sh
ssh root@sw-my ./populatetestdb.sh

echo "Deploying webapp and restarting Tomcat(1)..."
ssh root@sw-as1 rm -rf /home/tomcat/apache-tomcat-7.0.23/webapps/skillworld*
scp target/skillworld.war root@sw-as1:/home/tomcat/apache-tomcat-7.0.23/webapps
ssh root@sw-as1 /home/tomcat/apache-tomcat-7.0.23/bin/startup.sh

echo "Deploying webapp and restarting Tomcat(2)..."
ssh root@sw-as2 rm -rf /home/tomcat/apache-tomcat-7.0.23/webapps/skillworld*
scp target/skillworld.war root@sw-as2:/home/tomcat/apache-tomcat-7.0.23/webapps
ssh root@sw-as2 /home/tomcat/apache-tomcat-7.0.23/bin/startup.sh
